<template>
	<div class="project-progress-tracking">
		<zk-searcher v-model="query" :options="searchColumns" />
		<w-block class="body" title="项目信息列表" style="margin-top: 10px">
			<zk-table
				:columns="tableColumns"
				:service="service"
				:query="query"
				:actions="actions"
				:requestInterceptor="requestInterceptor"
				@doOtherAction="doActions"
			>
			</zk-table>
		</w-block>
	</div>
</template>
<script>
import { TYPE_ENUM }                          from '@/common/zk-constants'
import { projectProgressTracking as service } from '@/services'
import SearchTableCRUDMixin                   from '@/mixins/search-table-crud-mixin'

const columns = [
	{ 'label': '项目类型', type: TYPE_ENUM.SELECT, storeKey: 'projectType', 'key': 'project_type', table: true, search: true, form: true, required: true, },
	{ 'label': '启动时间', 'key': 'start_time', search: true, span: 14, rangeKeys: ['start_start_time', 'start_end_time'], type: TYPE_ENUM.DATE_RANGE, },
	{ 'label': '归档时间', 'key': 'guidang_time', search: true, span: 14, rangeKeys: ['guidang_start_time', 'guidang_end_time'], type: TYPE_ENUM.DATE_RANGE, },
	{ 'label': '阶段', 'key': 'app_phase', table: true, type: TYPE_ENUM.SELECT, storeKey: 'stage', form: true },
	{ 'label': '审批结束时间', 'key': 'end_time', rangeKeys: ['end_start_time', 'end_end_time'], type: TYPE_ENUM.DATE_RANGE, span: 14 },
	{ 'label': '项目名称', 'key': 'project_name', table: true, search: true, form: true, required: true },
	{ 'label': '选用模版', 'key': 'template_name', table: true, form: true, required: true },
	{ 'label': '任务总数', 'key': 'all_num', table: true },
	{ 'label': '已完成', 'key': 'done_num', table: true },
	{ 'label': '未完成', 'key': 'undone_num', table: true },
	{ 'label': '启动时间', 'key': 'start_time', table: true, type: TYPE_ENUM.DATE_TIME, form: true },
	{ 'label': '归档时间', 'key': 'guidang_time', table: true, type: TYPE_ENUM.DATE_TIME, form: true },
]

const actions = [
	{ classname: 'primary', text: '查看', type: 'review' }
]
export default {
	mixins  : [SearchTableCRUDMixin],
	data() {
		return {
			columns,
			service,
			actions,
		}
	},
	computed: {
		modalTitle() {
			return this.isAddModal ? '添加' : '编辑'
		}
	},
	methods : {
		requestInterceptor(query) {
			return { ...query, 'guidang_state': '99'/*归档*/ }
		},
		async doActions({ row = {}, type }) {
			// console.log(row);
			type === 'review' && this.$router.push({
				path : `/fishbone-diagram/${ row.project_id }`,
				query: {
					"project_name": row.project_name
				}
			});
		},
	},
}
</script>
<style scoped lang="scss">
</style>

